package org.njbdqn.commons.services;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class OutputService {
	private static ObjectMapper om = new ObjectMapper();

	public static void out(HttpServletResponse response,Object obj) {
		try {
			PrintWriter out = response.getWriter();
			out.write(om.writeValueAsString(obj));
			out.flush();
			out.close();
		} catch (JsonProcessingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
